package com.yykj.user.center.server.controller;

import com.yykj.common.dto.CreateAccountDTO;
import com.yykj.common.dto.GetFriendDTO;
import com.yykj.common.service.TencentService;
import com.yykj.common.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author chenl
 * @version 1.0
 * @date 2021/11/5 20:06
 */
@RestController
@RequestMapping("/api/tencent/message")
@Api(tags = "腾讯云即时通讯相关接口")
public class TencentController {
    @Autowired
    private TencentService tencentService;

    @GetMapping("/userSign")
    @ApiOperation(value = "获取用户UserSign", notes = "UserSig 是用户登录即时通信 IM 的密码")
    public String userSign(@RequestParam(value = "accid", required = true) String accid) {
        return tencentService.getUserSign(accid);
    }

    @GetMapping("/createAccount")
    @ApiOperation(value = "创建账户", notes = "创建账户")
    public CreateAccountDTO createAccount(@RequestParam(value = "identifier", required = true) String identifier,
                                          @RequestParam(value = "nick", required = true) String nick,
                                          @RequestParam(value = "faceUrl", required = true) String faceUrl) {
        return tencentService.createAccount(identifier, nick, faceUrl);
    }

    @GetMapping("/getFriend")
    @ApiOperation(value = "拉取好友", notes = "拉取好友")
    public GetFriendDTO getFriend(@RequestParam(value = "userId", required = true) String userId) {
        return tencentService.getFriend(userId);
    }
}
